//
//	File: OyFontManager.h
//
#ifndef OYFONTMANAGER_H
#define OYFONTMANAGER_H

#include "OyTTFFont.h"


class OySkinManager;
class OyDirect3D9;

class OyFontManager
{
public:

	OyFontManager(void);
	~OyFontManager(void);

	bool Initialize( OySkinManager *pSkinManager, LPDIRECT3DDEVICE9 pDevice, OyDirect3D9 *pOyD3D9 );
	void Release(void);
	void OnDeviceLost(void);
	void OnDeviceReset(void);


	bool AddFont( const char* strName, const char* strPath, 
		int iSize = 20,	bool bBold = false, bool bItalic = false );

	bool DoDrawTextInPos( const TCHAR* sText, float x, float y,
						  DWORD FontColor, DWORD flag, float fFontSize, 
						  bool bKerning, bool bUnderl );
	void PreCacheChar(const TCHAR* sText);

	HRESULT FlushAllFonts();

	bool IsFontLoaded(const char* strName);
	void UnloadFont(const char* strName);

	void SetActiveFont( const char* strName );
	Oy_TTF_Font* GetFontByName(const char* strName);

	int GetActiveFontHeight();
	void SetActiveFontHotSpot( float HotSpotx, float HotSpoty );
	void SetActiveFontScale( float sx, float sy );

private:
	static const unsigned int INIT_FONTLIST_ARRAY_NUM = 4;
    OySkinManager						*m_pSkinManager;
    LPDIRECT3DDEVICE9					m_pDevice;
    OyDirect3D9							*m_pOyD3D9;


	OyArrayStack<Oy_TTF_Font*>			m_OyFontList;

	Oy_TTF_Font							*m_ActiveFont;

	FT_Library							m_FTLib;

};

#endif